<?php
global $language;
$language = $this->session->userdata('ua_language');

if ( empty($language) ) {
    if ( $this->config->item('ua_multi_language') ) {
        $language = $this->lang_detect->language();
    } else {
        $language = $this->config->item('language');
    }
    $this->session->set_userdata('ua_language', $language);
}

/*Load the language files. Here we load for example the miniapp_lang.php*/
$this->lang->load('miniapp', $language);

// set xml:lang
$lang = 'ua_lang_'.$language;

$lang = $this->config->item($lang);
if( empty($lang) ) 
    $lang = 'en';

// set the character set
$charset = 'ua_charset_'.$language;



$charset = $this->config->item($charset);
if( empty($charset) )
    $charset = 'utf-8';


$html_title = 'MeetTheGreeks '
    . $this->lang->line('ma_template_example')
    . ' | '
    . $this->lang->line('ma_template_user_authenic');
$html_title .= ( ! empty($title) ) ? " - ".$title : '';


// send raw HTTP headers to set the content type for MS IE
$this->output->set_header("Content-Type: text/html; charset=UTF-8");

echo "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n";

?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?=$lang?>" lang="<?=$lang?>">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=<?=$charset?>" />
        <title><?=to_entities($html_title.' | '.$title)?></title>


        <meta name="Description" content="<?=to_entities($meta_description)?>" />
        <meta name="Keywords" content="<?=to_entities($meta_keywords)?>" />
        <meta http-equiv="imagetoolbar" content="no" />
        <meta name="copyright" content="Copyright © GreekLover" />
        <meta name="distribution" content="Global" />
        <meta name="rating" content="general" />
        <meta name="language" content="en" />
        <meta http-equiv="Content-language" content="en" />
        <link rel="shortcut icon" href="<?=base_url()?>favicon.ico" type="image/x-icon" />

        <link href="<?=base_url()?>public/css/styles.css" rel="stylesheet" type="text/css" media="all" />
        <!--[if lt IE 8]><link href="<?=base_url()?>public/css/ie.css" rel="stylesheet" type="text/css" media="all" /><![endif]-->

        <?php $rss = isset($category) ? 'feed/category/'.$category->category_id : 'feed'?>
        <link rel="alternate" type="application/rss+xml" title="Latest listings RSS" href="<?=site_url($rss)?>" />

        <?php $this->load->view($js_variables)?>

        <script type="text/javascript" src="<?=base_url()?>public/js/jquery.js" charset="utf-8"></script>
        <script type="text/javascript" src="<?=base_url()?>public/js/calendar.js" charset="utf-8"></script>
        <script type="text/javascript"  src="<?=base_url()?>public/js/jquery.blockUI.js" charset="utf-8"></script>
        <script type="text/javascript" src="<?=base_url()?>public/js/base.js" charset="utf-8"></script>

    </head>
    <body>
        <div id="layout">
            <div id="header" class="clearfix">
                <div class="container">
                    <h1 class="logo">
                        <?=anchor('', to_entities($site_name), array('title' => to_entities($meta_description)))?>
                    </h1>
                </div>

            </div><!-- END #HEADER -->

            <div id="wrapper">

                <ul id="mainnav"> <!--Top menu -->
                    <li><?php echo anchor('', $this->lang->line('ma_menu_title_home'));?></li>

                    <li ><?php echo anchor('page/about', $this->lang->line('ma_menu_about'));?></li>

                    <li id="language_select">
                        <?php
                        $options = array(
                            'english' => 'English',
                           /* 'french'  => 'Français',*/
                            'greek'   => 'Ελληνικά'
                        );
                        $js = 'onchange ="submit()"';
                        ?>


                        <?php echo form_open('listings/set_language');
                        //redirect to controller user to function set_language?>

                        <?php echo form_dropdown('lang_select', $options, $language, $js);?>
                        <?php echo form_close();?>
                    </li>
                </ul>

                <div id="main" class="clearfix">

                    <?php $this->load->view($flashdata)?>

                    <?php $this->load->view($content_template)?>

                </div>

            </div><!-- END #WRAPPER -->

        </div><!-- END #LAYOUT -->

        <div id="footer" class="clearfix">

            <div class="container">

        <!--	<p>This software is released under <?php //echo anchor('http://www.gnu.org/licenses/gpl-3.0.txt','GNU GPL V3')?> and proudly fueled by the <?php //echo anchor('http://codeigniter.com', 'CodeIgniter PHP framework')?>.<br />
		You can <?php //echo safe_mailto($site_email, 'contact us')?> for licensing and related questions. Bug reports and support are handled on our <?php //echo anchor('http://www.assembla.com/spaces/linkster', 'project page')?>.</p>
                <p><small>Rendered in {elapsed_time} seconds - using {memory_usage} of memory | Valid <?php //echo anchor('http://validator.w3.org/check?uri='.base_url(), 'XHTML', array('title' => 'Valid XHTML 1.0 Strict'))?> &amp; <?php //echo anchor('http://jigsaw.w3.org/css-validator/validator?uri='.base_url(), 'CSS', array('title' => 'Valid CSS 2.1'))?></small></p>-->
            </div>

        </div><!-- END #FOOTER -->
    </body>
</html>